<title>增加质量监督项目</title>
<div class="row">
	<div class="col-xs-12 quality_add">
		<form class="form-horizontal registerform">
			<div class="space-4"></div>
			<div class="space-4"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">工程名称：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*" id="hx_name"
							nullmsg="请输入工程名称" placeholder="请输入工程名称">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">状态：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<select datatype="*" nullmsg="请选择状态" id="hx_status">
							<option>请选择状态</option>
							<?php
							if (is_array ( $status ) && count ( $status ) > 0) {
								foreach ( $status as $item ) {
									?>
									<option value="<?=$item['id']?>"><?=$item['sys_value']?></option>
									<?php
								}
							}
							?>
						</select>
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">工程性质：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<select datatype="*" nullmsg="请选择工程性质" id="hx_nature">
							<option>请选择区域</option>
							<?php
							if (is_array ( $nature ) && count ( $nature ) > 0) {
								foreach ( $nature as $item ) {
									?>
									<option value="<?=$item['id']?>"><?=$item['sys_value']?></option>
									<?php
								}
							}
							?>
						</select>
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">区域：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<select datatype="*" nullmsg="请选择区域" id="hx_address">
							<option>请选择区域</option>
							<?php
							if (is_array ( $area ) && count ( $area ) > 0) {
								foreach ( $area as $item ) {
									?>
									<option value="<?=$item['id']?>"><?=$item['sys_value']?></option>
									<?php
								}
							}
							?>
						</select>
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">结构类型/层次：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*"
							id="hx_structure_type" nullmsg="请输入结构类型/层次"
							placeholder="请输入结构类型/层次">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">建筑面积：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*" id="hx_area"
							nullmsg="请输入建筑面积" placeholder="请输入建筑面积">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">工程造价：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*" id="hx_cost"
							nullmsg="请输入工程造价" placeholder="请输入工程造价">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">施工单位：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*"
							id="hx_construction_unit" nullmsg="请输入施工单位" placeholder="请输入施工单位">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">勘察单位：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*"
							id="hx_reconnaissance_unit" nullmsg="请输入勘察单位"
							placeholder="请输入勘察单位">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right"
					for="form-field-name">监理单位：</label>
				<div class="input-group col-sm-9">
					<div class="in_txt">
						<input type="text" class="input-xlarge" datatype="*"
							id="hx_supervision_units_name" nullmsg="请输入监理单位"
							placeholder="请输入监理单位">
					</div>
					<div class="tishi">
						<div class="Validform_checktip"></div>
					</div>
				</div>
			</div>
			<div class="space-4"></div>
			<div class="clearfix form-actions">
				<div class="col-md-offset-3 col-md-9">
					<button class="btn btn-info save" type="button" id="btnSubmit">
						<i class="ace-icon fa fa-check bigger-110"></i>增加
					</button>
					&nbsp; &nbsp;
					<button class="btn" type="button">
						<i class="ace-icon glyphicon glyphicon-remove bigger-110"></i>取消
					</button>
				</div>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
var scripts = [null,null];
var $scope = $(".quality_add");
$('.page-content-area').ace_ajax('loadScripts', scripts, function(){
	//表单验证
	var vform=$(".registerform").Validform({
		tiptype:2
	});
	$('#btnSubmit').click(function() {
		if (!vform.check(false)) {
			return;
		}
		var name = $("#hx_name", $scope).val();
		var nature = $("#hx_nature", $scope).val();
		var address = $("#hx_address", $scope).val();
		var structure_type = $("#hx_structure_type", $scope).val();
		var area = $("#hx_area", $scope).val();
		var cost = $("#hx_cost", $scope).val();
		var construction_unit = $("#hx_construction_unit", $scope).val();
		var reconnaissance_unit=$("#hx_reconnaissance_unit",$scope).val();
		var supervision_units_name=$("#hx_supervision_units_name",$scope).val();
		var status = $("#hx_status",$scope).val();
		$.post('/quality/ajax_quality_add', {
			'nature': nature,
			'name': name,
			'address': address,
			'structure_type': structure_type,
			'area': area,
			'cost': cost,
			'construction_unit': construction_unit,
			'reconnaissance_unit':reconnaissance_unit,
			'supervision_units_name':supervision_units_name,
			'status':status
		}, function(data) {
			if (200 === data.status) {
				message_box.show(data.data);
				gDialog.fClose();
				if (typeof(pageObj) != "undefined") {
					if (data.page < pageObj.get_page_count()) {
						pageObj.dec_page_count(); //-1
						if (pageObj.get_page_index() > pageObj.get_page_count()) {
							pageObj.go_page(pageObj.get_page_count());
						} else {
							pageObj.cur_page();
						}
					} else {
						pageObj.cur_page();
					}
				}
			} else {
				message_box.show(data.data);
			}
		}, 'json');
		//console.log(form_data)
	})
})
</script>
